package com.example.mobile2021606177cke0507;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class ShowDataActivity extends AppCompatActivity {

    private TextView tvShowDataUserTitle;
    private TextView tvShowDataUserName;
    private TextView tvShowDataUserPassword;
    private TextView tvShowDatasupplier;
    private Button  btnSupplierSubmit;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_data);
        initView();
        Intent intent=getIntent();


        String userName=intent.getStringExtra("userName");
        tvShowDataUserName.setText(userName);


        Bundle bundle=intent.getExtras();
        String password=bundle.getString("password");
        tvShowDataUserPassword.setText(password);
        tvShowDatasupplier.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent1=new Intent(ShowDataActivity.this,SupplierActivity.class);
                startActivityForResult(intent1,1);
            }
        });
    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 1 && resultCode == RESULT_OK){
            String supplierName = data.getStringExtra("supplier");
            tvShowDatasupplier.setText(supplierName);
        }
    }






    private void initView() {
        tvShowDataUserTitle = (TextView) findViewById(R.id.tvShowDataUserTitle);
        tvShowDataUserName = (TextView) findViewById(R.id.tvShowDataUserName);
        tvShowDataUserPassword = (TextView) findViewById(R.id.tvShowDataUserPassword);
        tvShowDatasupplier=(TextView)findViewById(R.id.tvSupplierTitle);
        tvShowDatasupplier=(Button)findViewById(R.id.btnSupplierSubmit);
    }
}